/*
 * Copyright (C) 2015-2021 Swift Navigation Inc.
 * Contact: https://support.swiftnav.com
 *
 * This source is subject to the license found in the file 'LICENSE' which must
 * be be distributed together with this source. All other rights reserved.
 *
 * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
 * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
 */
package com.swiftnav.sbp.client;

import com.swiftnav.sbp.SBPBinaryException;
import com.swiftnav.sbp.SBPMessage;
import com.swiftnav.sbp.SBPMessage.Builder;
import com.swiftnav.sbp.SBPMessage.Parser;
((*- for p in packages *))
((*- for m in p.definitions *))
((*- if m.is_real_message *))
import com.(((p.identifier))).(((m.identifier|classnameify)));
((*- endif *))
((*- endfor *))
((*- endfor *))

final class MessageTable {
    static SBPMessage dispatch(SBPMessage msg) throws SBPBinaryException {
        switch (msg.type) {
            ((*- for p in packages *))
            ((*- for m in p.definitions *))
            ((*- if m.is_real_message *))
            case (((m.identifier|classnameify))).TYPE:
                return new (((m.identifier|classnameify)))(msg);
            ((*- endif *))
            ((*- endfor *))
            ((*- endfor *))
        }
        return msg;
    }
}


